import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import vueDevTools from 'vite-plugin-vue-devtools'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { VantResolver } from '@vant/auto-import-resolver'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueJsx(),
    // vueDevTools(),
    AutoImport({
      resolvers: [VantResolver()],
    }),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
  server: {
    host: '0.0.0.0',
    allowedHosts: true,
    proxy: {
      '/api': {
        // target: 'http://192.168.60.61:9632', //曾云华
        // target: 'http://192.168.50.85:9633',
        // target: 'http://172.16.200.4:9632',
        // target: 'http://192.168.60.82:9632', //谌仲
        // target: 'http://192.168.50.85:9632', //崔翔
        // target: 'http://192.168.60.63:9632', //何一鸣
        // target: 'http://op.dev.boeyo.com',
        target: 'http://office.boeyo.com:9632',
        changeOrigin: true,
      },
    },
  },
})
